package com.gt.xmall.model;

import javax.persistence.*;

import java.io.Serializable;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;


@Entity
@Table(name = "gtd_collection")
public class GtdCollection extends IdEntity implements  Serializable{
	 
	
	 
 
	

 
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
	
	private java.lang.String decription;
	
	private java.lang.Integer flag;
	
	private java.lang.Integer refId;
	
 
	
	private java.util.Date startTime;
	
	private java.util.Date endTime;
	//columns END
	private GtdProject gtdProject;
	

	
	@Column(name = "decription", unique = false, nullable = true, insertable = true, updatable = true, length = 2147483647)
	public java.lang.String getDecription() {
		return this.decription;
	}
	
	public void setDecription(java.lang.String value) {
		this.decription = value;
	}
	
	@Column(name = "flag", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getFlag() {
		return this.flag;
	}
	
	public void setFlag(java.lang.Integer value) {
		this.flag = value;
	}
	
	@Column(name = "ref_id", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getRefId() {
		return this.refId;
	}
	
	public void setRefId(java.lang.Integer value) {
		this.refId = value;
	}
	
	
	
	
	
	@Column(name = "start_time", unique = false, nullable = true, insertable = true, updatable = true, length = 0)
	public java.util.Date getStartTime() {
		return this.startTime;
	}
	
	public void setStartTime(java.util.Date value) {
		this.startTime = value;
	}
	
	
	
	@Column(name = "end_time", unique = false, nullable = true, insertable = true, updatable = true, length = 0)
	public java.util.Date getEndTime() {
		return this.endTime;
	}
	
	public void setEndTime(java.util.Date value) {
		this.endTime = value;
	}
	
	
	
	
	@ManyToOne( cascade = {CascadeType.MERGE,CascadeType.REFRESH }, optional = true ,fetch = FetchType.LAZY)
	@JoinColumn(name = "project_id") 
	 
	public GtdProject getGtdProject() {
		return gtdProject;
	}

	public void setGtdProject(GtdProject gtdProject){
		this.gtdProject = gtdProject;
	}
	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("Decription",getDecription())
			.append("Flag",getFlag())
			.append("RefId",getRefId())
			 
			.append("StartTime",getStartTime())
			.append("EndTime",getEndTime())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof GtdCollection == false) return false;
		if(this == obj) return true;
		GtdCollection other = (GtdCollection)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
}

